/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2025 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define SYS_ON_LED_Pin GPIO_PIN_13
#define SYS_ON_LED_GPIO_Port GPIOC
#define LA_Pin GPIO_PIN_0
#define LA_GPIO_Port GPIOA
#define LA_EXTI_IRQn EXTI0_IRQn
#define LD_Pin GPIO_PIN_1
#define LD_GPIO_Port GPIOA
#define LD_EXTI_IRQn EXTI1_IRQn
#define TP_Pin GPIO_PIN_2
#define TP_GPIO_Port GPIOA
#define TP_EXTI_IRQn EXTI2_IRQn
#define FA_Pin GPIO_PIN_3
#define FA_GPIO_Port GPIOA
#define FA_EXTI_IRQn EXTI3_IRQn
#define FD_Pin GPIO_PIN_4
#define FD_GPIO_Port GPIOA
#define FD_EXTI_IRQn EXTI4_IRQn
#define SW_EYES_Pin GPIO_PIN_5
#define SW_EYES_GPIO_Port GPIOA
#define SW_EYES_EXTI_IRQn EXTI9_5_IRQn
#define MAIN_KEY_IO_Pin GPIO_PIN_6
#define MAIN_KEY_IO_GPIO_Port GPIOA
#define MAIN_KEY_IO_EXTI_IRQn EXTI9_5_IRQn
#define DC_IN_DET_Pin GPIO_PIN_7
#define DC_IN_DET_GPIO_Port GPIOA
#define BUZ_CTL_Pin GPIO_PIN_0
#define BUZ_CTL_GPIO_Port GPIOB
#define BAT_STAT_LED_Pin GPIO_PIN_1
#define BAT_STAT_LED_GPIO_Port GPIOB
#define SYS_keep_Pin GPIO_PIN_10
#define SYS_keep_GPIO_Port GPIOB
#define PC_DET_Pin GPIO_PIN_12
#define PC_DET_GPIO_Port GPIOB
#define MCU_PC_RST_SW_Pin GPIO_PIN_13
#define MCU_PC_RST_SW_GPIO_Port GPIOB
#define CHG_EN1_Pin GPIO_PIN_5
#define CHG_EN1_GPIO_Port GPIOB
#define Magnetic_MCU_Pin GPIO_PIN_8
#define Magnetic_MCU_GPIO_Port GPIOB
#define Magnetic_MCU_EXTI_IRQn EXTI9_5_IRQn
#define LED32_Pin GPIO_PIN_9
#define LED32_GPIO_Port GPIOB

/* USER CODE BEGIN Private defines */
#define Q4_ON								HAL_GPIO_WritePin(SYS_keep_GPIO_Port, SYS_keep_Pin, GPIO_PIN_SET);
#define Q4_OFF							HAL_GPIO_WritePin(SYS_keep_GPIO_Port, SYS_keep_Pin, GPIO_PIN_RESET);
#define BUZZ_ON							HAL_GPIO_WritePin(BUZ_CTL_GPIO_Port, BUZ_CTL_Pin, GPIO_PIN_SET);
#define BUZZ_OFF						HAL_GPIO_WritePin(BUZ_CTL_GPIO_Port, BUZ_CTL_Pin, GPIO_PIN_RESET);
#define MCU_PC_RST_SW_ON		HAL_GPIO_WritePin(MCU_PC_RST_SW_GPIO_Port, MCU_PC_RST_SW_Pin, GPIO_PIN_RESET);
#define MCU_PC_RST_SW_OFF		HAL_GPIO_WritePin(MCU_PC_RST_SW_GPIO_Port, MCU_PC_RST_SW_Pin, GPIO_PIN_SET);
#define BAT_STAT_LED_ON			HAL_GPIO_WritePin(BAT_STAT_LED_GPIO_Port, BAT_STAT_LED_Pin, GPIO_PIN_SET);
#define BAT_STAT_LED_OFF		HAL_GPIO_WritePin(BAT_STAT_LED_GPIO_Port, BAT_STAT_LED_Pin, GPIO_PIN_RESET);
#define SYS_ON_LED_ON				HAL_GPIO_WritePin(SYS_ON_LED_GPIO_Port, SYS_ON_LED_Pin, GPIO_PIN_SET);
#define SYS_ON_LED_OFF			HAL_GPIO_WritePin(SYS_ON_LED_GPIO_Port, SYS_ON_LED_Pin, GPIO_PIN_RESET);
#define CHG_EN1_ON					HAL_GPIO_WritePin(CHG_EN1_GPIO_Port, CHG_EN1_Pin, GPIO_PIN_SET);
#define CHG_EN1_OFF					HAL_GPIO_WritePin(CHG_EN1_GPIO_Port, CHG_EN1_Pin, GPIO_PIN_RESET);

#define LA_State						HAL_GPIO_ReadPin(LA_GPIO_Port, LA_Pin)
#define LD_State						HAL_GPIO_ReadPin(LD_GPIO_Port, LD_Pin)
#define FA_State						HAL_GPIO_ReadPin(FA_GPIO_Port, FA_Pin)
#define FD_State						HAL_GPIO_ReadPin(FD_GPIO_Port, FD_Pin)
#define TP_State						HAL_GPIO_ReadPin(TP_GPIO_Port, TP_Pin)
#define SW_State						HAL_GPIO_ReadPin(SW_EYES_GPIO_Port, SW_EYES_Pin)
#define PC_DET_State 				HAL_GPIO_ReadPin(PC_DET_GPIO_Port, PC_DET_Pin)								//1 - �ѿ���		  0 - δ����
#define DC_IN_DET_State		  HAL_GPIO_ReadPin(DC_IN_DET_GPIO_Port, DC_IN_DET_Pin)					//1 - ��������  0 - ��ع���
#define Magnetic_MCU_State  HAL_GPIO_ReadPin(Magnetic_MCU_GPIO_Port, Magnetic_MCU_Pin)		//1 - ���ֱ�		  0 - ���ֱ�
#define MAIN_KEY_IO_State  	HAL_GPIO_ReadPin(MAIN_KEY_IO_GPIO_Port, MAIN_KEY_IO_Pin)		//1 - ���ֱ�		  0 - ���ֱ�

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
